<!-- Dom模板 -->
<template>
  <div>
    <!-- Dom内容 -->
    <div class="mainTop">
      <span>商品/添加商品</span>
      <span @click="Tostudents">返回</span>
    </div>
    <div class="addMain">
    <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm">
      <el-form-item label="用户昵称" prop="username">
        <el-input ref="username" v-model="ruleForm.username"></el-input>
      </el-form-item>
      <el-form-item label="手机号" prop="userphone">
        <el-input ref="userphone" v-model="ruleForm.userphone"></el-input>
      </el-form-item>
      <el-form-item label="密码" prop="password">
        <el-input ref="password" v-model="ruleForm.password"></el-input>
      </el-form-item>
      <el-form-item label="做题时间" prop="dotime">
        <el-input ref="dotime" v-model="ruleForm.dotime"></el-input>
      </el-form-item>
        <span>点击获取当前时间</span>
    </el-form>
    <div>
        <button  class="addNow">立即添加</button>
        <button class="cancel">取消</button>
    </div>
    </div>
   
  </div>
</template>

<script>
// import a from './a'; // 引入组件
import * as API from '../../../api/index';
export default {
  name: '',
  data() {
      var checkAge = (rule, value, callback) => {
        if (!value) {
          return callback(new Error('年龄不能为空'));
        }
        setTimeout(() => {
          if (!Number.isInteger(value)) {
            callback(new Error('请输入数字值'));
          } else {
            if (value < 18) {
              callback(new Error('必须年满18岁'));
            } else {
              callback();
            }
          }
        }, 1000);
      };
      var validatePass = (rule, value, callback) => {
        if (value === '') {
          callback(new Error('请输入密码'));
        } else {
          if (this.ruleForm.checkPass !== '') {
            this.$refs.ruleForm.validateField('checkPass');
          }
          callback();
        }
      };
      var validatePass2 = (rule, value, callback) => {
        if (value === '') {
          callback(new Error('请再次输入密码'));
        } else if (value !== this.ruleForm.pass) {
          callback(new Error('两次输入密码不一致!'));
        } else {
          callback();
        }
      };
      var doTime = (rule, value, callback) => {
        
      };
      return {
        obj:{},
        // timeValue:'',

        ruleForm: {
          password: '',
          username:'',
          userphone:'',
          dotime:''
        },
        rules: {
          password: [
            { required: true, message: '请输入密码', trigger: 'blur' },
            { min: 3, max: 5, message: '长度在 3 到 5 个字符', trigger: 'blur' }
          ],
          username:[
            {required: true, message: '请输入用户昵称', trigger: 'blur'}
          ],
          userphone:[
            {required: true, message: '请输入手机号', trigger: 'blur'}
          ],
          dotime:[
            {required: true, message: '做题时间不能为空', trigger: 'blur'}
          ]
        }
      }
    },
  // 生命周期 - 创建完成（访问当前this实例）
  created() {
      
  },
  // 生命周期 - 挂载完成（访问DOM元素）
  mounted() {
    
  },
  // Vue方法定义
  methods: {
Tostudents(){
  this.$router.history.go(-1)
}
  }
}
</script>
<style>

</style>
<style scoped>
/* @import url(''); 引入css类 */
@import url('../../../../iconfont/font_2151974_oa0k70sjxlh/iconfont.css');
span{
  margin-left: 100px;
  cursor: pointer;
}
.addNow{
    background: #38a189;
    border: none;
    padding: 8px 16px;
    font-size: 16px;
    color: white;
    border-radius: 4px;
}
.cancel{
    background: #eee;
    border: none;
    padding: 8px 16px;
    font-size: 16px;
    color: black;
    border-radius: 4px;
}
.timeInput{
    width: 25%;
    border-radius: 4px;
    background-image: none;
    border: 1px solid #DCDFE6;
    box-sizing: border-box;
    color: #606266;
    display: inline-block;
    font-size: inherit;
    height: 40px;
    line-height: 40px;
    outline: 0;
    padding: 0 15px;
}
.timeInput2{
  width: 25%;
    border-radius: 4px;
    background-image: none;
    border: 1px solid red;
    box-sizing: border-box;
    color: #606266;
    display: inline-block;
    font-size: inherit;
    height: 40px;
    line-height: 40px;
    outline: 0;
    padding: 0 15px;
}
.nowTime{
    outline: none;
    border: 1px solid #eee;
    background: white;
    margin-left: 18px;
    box-shadow: 0px 1px 5px 3px #ccc;
    color: red;
}
.nowTime2{
    outline: none;
    border: 1px solid #eee;
    background: white;
    margin-left: 18px;
    box-shadow: 0px 1px 5px 3px #ccc;
    color: green;
}

i{
  color: red;
  float: left;
  font-size: 26px;
}
input{
  width: 250px;
    height: 30px;
}
.mainTop{
  width: 100%;
    height: 50px;
    line-height: 50px;
    overflow: hidden;
}
.mainTop span:nth-child(1){
  float: left;
    font-weight: 700;
    font-size: 17px;
}
.mainTop span:nth-child(2){
  float: right;
    width: 76px;
    height: 30px;
    line-height: 30px;
    text-align: center;
    color: white;
    border-radius: 4px;
    font-size: 14px;
    background: #38a189;
}
.addMain{
  background: white;
  box-sizing: border-box;
    padding: 24px;
}
.addMain>p:nth-child(1){
    font-family: fangsong;
    font-weight: bold;
    margin-bottom: 20px;
}

.addMain>div{
  width: 100%;
    height: auto;
    margin: 20px 0;
    font-family: fangsong;
    font-weight: bold;
}
</style>